<?xml version="1.0"?>

<!-- gjdoc-index.rng
     Copyright (C) 2003 Free Software Foundation, Inc.

This file is part of GNU Classpath.

GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
 
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING.  If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. -->

<grammar 
      xmlns="http://relaxng.org/ns/structure/1.0" 
      xmlns:a="http://relaxng.org/ns/annotation/1.0" 
      xmlns:gjdoc="http://www.gnu.org/software/cp-tools/gjdocxml">

   <include href="gjdoc-common.rng"/>
   
   <a:documentation>
      The Relax NG grammar for the XML index file generated by GNU
      Gjdoc.
   </a:documentation>

   <start>
      <a:documentation>
	 The root element for a Gjdoc index XML document.
      </a:documentation>

      <element name="gjdoc:rootdoc">
	 <a:documentation>
	    Corresponds to the Javadoc API RootDoc object, the root of
	    the generated documentation.
	 </a:documentation>
   
	 <zeroOrMore>
	    <ref name="specifiedclass-element"/>
	 </zeroOrMore>
	 
	 <zeroOrMore>
	    <ref name="specifiedpackage-element"/>
	 </zeroOrMore>
	 
	 <zeroOrMore>
	    <ref name="packagedoc-element"/>
	 </zeroOrMore>

	 <zeroOrMore>
	    <ref name="classdoc-element"/>
	 </zeroOrMore>
      </element>
   </start>
   
   <define name="containsClass-element">
      <element name="gjdoc:containsClass">
	 <a:documentation>
	    Corresponds to a class contained in a package or in
	    another class.
	 </a:documentation>

	 <ref name="qualifiedtypename-attribute"/>
      </element>
   </define>

   <define name="specifiedclass-element">
      <element name="gjdoc:specifiedclass">
	 <a:documentation>
	    Corresponds to a class named on the Gjdoc command
	    line.  This is a class the user explicitly wants
	    documentation generated for.
	 </a:documentation>
	 
	 <attribute name="name">
	    <a:documentation>
	       The name of the class as given by the user on the command
	       line. (CHECK)
	    </a:documentation>	    

	    <text/>
	 </attribute>
      </element>
   </define>

   <define name="specifiedpackage-element">
      <element name="gjdoc:specifiedpackage">
	 <a:documentation>
	    Corresponds to a package named on the Gjdoc command
	    line.  This is a package the user explicitly wants
	    documentation generated for.
	 </a:documentation>
	 
	 <attribute name="name">
	    <a:documentation>
	       The full name of the package.
	    </a:documentation>
	    
	    <text/>
	 </attribute>
      </element>
   </define>

   <define name="packagedoc-element">
      <element name="gjdoc:packagedoc">
	 <a:documentation>
	    Corresponds to a package for which XML documentation
	    has been generated.  This is not necessarily a package
	    the user requested generation for.
	 </a:documentation>

	 <ref name="name-attribute"/>
	 <ref name="firstSentenceTags-element"/>

	 <zeroOrMore>
	    <ref name="containsClass-element"/>
	 </zeroOrMore>	    
      </element>
   </define>

   <define name="classdoc-element">
      <element name="gjdoc:classdoc">
	 <a:documentation>
	    Corresponds to a class for which XML documentation has
	    been generated.
	 </a:documentation>
	       
	 <ref name="name-attribute"/>
	 <ref name="qualifiedtypename-attribute"/>

	 <optional>
	    <a:documentation>
	       The following is optional because the root class
	       java.lang.Object does not have a superclass. For all
	       other classes, this element should be specified.
	    </a:documentation>

	    <ref name="superclass-element"/>
	 </optional>

	 <zeroOrMore>
	    <ref name="implements-element"/>
	 </zeroOrMore>

	 <zeroOrMore>
	    <ref name="superimplements-element"/>
	 </zeroOrMore>

	 <ref name="containingPackage-element"/>

	 <zeroOrMore>
	    <ref name="isError-element"/>
	 </zeroOrMore>

	 <zeroOrMore>
	    <ref name="isException-element"/>
	 </zeroOrMore>

	 <zeroOrMore>
	    <ref name="isInterface-element"/>
	 </zeroOrMore>

	 <zeroOrMore>
	    <ref name="containsClass-element"/>
	 </zeroOrMore>
      </element>
   </define>
</grammar>
